<script type="text/javascript">
function confirmDelete(id) {
	var r=confirm("Biztos, hogy törlöd a csapatot?");
	
	if (r==true) {
		document.deleteForm.teamId.value = id;
		document.deleteForm.submit();
	}
}
</script>
<form name="deleteForm" action="classes/db/delete.php">
<input type="hidden" id="teamId" name="teamId" value="">
<input type="hidden" id="objectType" name="objectType" value="team">
</form>
<table class="table">
	<thead>
		<tr>
			<th>Csapat neve</th>
			<th>Műveletek</th>
		</tr>
	</thead>
	<tbody>
		<?php

		include "classes/db/dbmanager.php";
		$pDatabase = Database::getInstance();
		$sql="SELECT * FROM team ORDER BY letterId, teamName";
		$result = $pDatabase->query($sql);
		while($row = mysql_fetch_array($result)) {
			echo "<tr><td><a href=\"index.php?site=admin&submenu=editteam&id=".$row["id"]."\">".$row["teamName"]."</a></td>";
			echo "<td><a href=\"index.php?site=admin&submenu=editimage&id=".$row["id"]."\" title=\"Képek szerkesztése\"><img src=\"img/icon_tshirt.png\" height=\"20\" width=\"20\"/></a><a href=\"javascript:confirmDelete(".$row["id"].")\"><img title=\"Csapat törlése\" src=\"img/icon_delete.png\" height=\"20\" width=\"20\"/></a></td></tr>";
		}
		?>
	</tbody>
</table>
